﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Vision.Core.Entities.Activities
{
    /// <summary>
    /// 
    /// </summary>
    [Serializable()]    
    public class VisionActivityParameterCollection : List<VisionActivityParameter>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameterName"></param>
        /// <param name="parameterValue"></param>
        public void Add(string parameterName, object parameterValue)
        {
            base.Add(new VisionActivityParameter(parameterName, parameterValue));  
        }
        
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IDictionary<string, object> ToDictionary()
        {
            Dictionary<string, object> dictionary = new Dictionary<string, object>();
            foreach (VisionActivityParameter param in this){
                dictionary.Add(param.ParameterName, param.ParameterValue);
            }
            return dictionary;
        }        
    }
    
    /// <summary>
    /// 
    /// </summary>
    [Serializable()]
    [DataContract()]
    public class VisionActivityParameter
    {
        /// <summary>
        /// 
        /// </summary>
        public VisionActivityParameter()
        {
        
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="parameterName"></param>
        /// <param name="parameterValue"></param>        
        public VisionActivityParameter(string parameterName, object parameterValue)
        {
            this.ParameterName = parameterName;
            this.ParameterValue = parameterValue;   
        }
       
        /// <summary>
        /// 
        /// </summary>
        [DataMember]
        public string ParameterName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [DataMember]
        public object ParameterValue { get; set; }
    }
}
